package org.sam.beatles.config;

import static com.metsci.glimpse.tinylaf.TinyLafUtils.initTinyLaf;

import org.sam.beatles.MainFrameContainer;
import org.sam.beatles.ui.MainFrameContainerImpl;
import org.sam.beatles.utils.BeanUtil;
import org.sam.beatles.utils.SpringBeanUtil;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 系统的bean组装地方
 * 
 * @author sam
 *
 */
@Configuration
public class BeanConfigure {

	/**
	 * bean工具助手类
	 * 
	 * @return
	 */
	@Bean
	public BeanUtil beanUtil() {
		return new SpringBeanUtil();
	}

	/**
	 * 主容器管理工具bean
	 * 
	 * @return
	 */
	@Bean(initMethod = "launcher", destroyMethod = "dispose")
	public MainFrameContainer mainFrameContainer() {
		try {
			// 初始化tiny皮肤
			initTinyLaf();
		} catch (Exception ex) {
			ex.printStackTrace();
		}
		return new MainFrameContainerImpl();
	}
}
